package com.ldy.demo4;

import java.util.concurrent.locks.ReentrantLock;

public class RepeatLock1 implements Runnable {
    ReentrantLock lock = new ReentrantLock();

	public void get() {
		lock.lock();
		System.out.println(Thread.currentThread().getName());
		// set();
		lock.unlock();
	}

	public void set() {
		lock.lock();
		System.out.println(Thread.currentThread().getName());
		lock.unlock();
	}

	public void run() {
		get();
	}

	public static void main(String[] args) {
		RepeatLock1 ss = new RepeatLock1();
		new Thread(ss, "s1").start();
		new Thread(ss, "s2").start();
		new Thread(ss, "s3").start();
	}
}